const judyAray = arr => {
  if (!arr || !arr.length) {
    return false
  }
  let have = false

  arr.map(data => {
    if (data) {
      have = true
    }
  })
  return have
}

export const judyCanLight = (data, expect) => {
  if (!data) {
    return false
  }
  let canLight = true
  for (let attr in expect) {
    if (expect[attr] instanceof Array) {
      let arrright = judyAray(data[attr])
      if (!arrright) {
        canLight = false
        break
      }
    } else {
      if (!data[attr] && data[attr] !== 0 && data[attr] !== false) {
        canLight = false
        break
      }
    }
  }
  return canLight
}
